<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddFieldsToVehiclesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('vehicles', function (Blueprint $table) {
            $table->decimal('price', 10, 2)->nullable()->comment('价格，单位（万）')->after('id');
            $table->string('introduction')->nullable()->comment('简介')->after('id');
        });

        Schema::table('customer_infos', function (Blueprint $table) {
            $table->string('channel')->nullable()->comment('渠道')->after('dealer_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('vehicles', function (Blueprint $table) {
            $table->dropColumn('price');
            $table->dropColumn('introduction');
        });

        Schema::table('customer_infos', function (Blueprint $table) {
            $table->dropColumn('channel');
        });
    }
}
